home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pangomm-1.4 / pangomm / layoutiter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  8.1 KB  |  236 lines

  1. // -*- c++ -*-
  2. // Generated by gtkmmproc -- DO NOT MODIFY!
  3. #ifndef _PANGOMM_LAYOUTITER_H
  4. #define _PANGOMM_LAYOUTITER_H
  5.  
  6. #include <glibmm.h>
  7.  
  8. /* $Id: layoutiter.hg,v 1.2 2003/12/14 11:54:05 murrayc Exp $ */
  9.  
  10. /* layoutiter.h
  11.  *
  12.  * Copyright 2001-2002 The gtkmm Development Team
  13.  *
  14.  * This library is free software; you can redistribute it and/or
  15.  * modify it under the terms of the GNU Library General Public
  16.  * License as published by the Free Software Foundation; either
  17.  * version 2 of the License, or (at your option) any later version.
  18.  *
  19.  * This library is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.  * Library General Public License for more details.
  23.  *
  24.  * You should have received a copy of the GNU Library General Public
  25.  * License along with this library; if not, write to the Free
  26.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  */
  28.  
  29. #include <pangomm/layoutline.h>
  30. #include <pangomm/layoutrun.h>
  31. #include <pango/pango-layout.h>
  32.  
  33.  
  34. namespace Pango
  35. {
  36.  
  37. /** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
  38.  */
  39. class LayoutIter
  40. {
  41.   public:
  42. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  43.   typedef LayoutIter CppObjectType;
  44.   typedef PangoLayoutIter BaseObjectType;
  45. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  46.  
  47. private:
  48.  
  49.   
  50. public:
  51.   // There's no other ctor, and the default ctor creates an invalid object.
  52.   // Therefore, Pango::LayoutIter is usable only as output argument.
  53.   LayoutIter();
  54.   ~LayoutIter();
  55.  
  56.   
  57.   /** Gets the current byte index. Note that iterating forward by char
  58.    * moves in visual order, not logical order, so indexes may not be
  59.    * sequential. Also, the index may be equal to the length of the text
  60.    * in the layout, if on the <tt>0</tt> run (see pango_layout_iter_get_run()).
  61.    * @return Current byte index.
  62.    */
  63.   int get_index() const;
  64.   
  65.   /** Gets the current run. When iterating by run, at the end of each
  66.    * line, there's a position with a <tt>0</tt> run, so this function can return
  67.    * <tt>0</tt>. The <tt>0</tt> run at the end of each line ensures that all lines have
  68.    * at least one run, even lines consisting of only a newline.
  69.    * @return The current run.
  70.    */
  71.   LayoutRun get_run() const;
  72.   
  73.   /** Gets the current line.
  74.    * @return The current line.
  75.    */
  76.   Glib::RefPtr<LayoutLine> get_line() const;
  77.   
  78.   /** Determines whether @a iter  is on the last line of the layout.
  79.    * @return <tt>true</tt> if @a iter  is on the last line.
  80.    */
  81.   bool at_last_line() const;
  82.  
  83.   
  84.   /** Moves @a iter  forward to the next character in visual order. If @a iter  was already at
  85.    * the end of the layout, returns <tt>false</tt>.
  86.    * @return Whether motion was possible.
  87.    */
  88.   bool next_char();
  89.   
  90.   /** Moves @a iter  forward to the next cluster in visual order. If @a iter 
  91.    * was already at the end of the layout, returns <tt>false</tt>.
  92.    * @return Whether motion was possible.
  93.    */
  94.   bool next_cluster();
  95.   
  96.   /** Moves @a iter  forward to the next run in visual order. If @a iter  was
  97.    * already at the end of the layout, returns <tt>false</tt>.
  98.    * @return Whether motion was possible.
  99.    */
  100.   bool next_run();
  101.   
  102.   /** Moves @a iter  forward to the start of the next line. If @a iter  is
  103.    * already on the last line, returns <tt>false</tt>.
  104.    * @return Whether motion was possible.
  105.    */
  106.   bool next_line();
  107.  
  108.   /** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
  109.    * Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.
  110.    * @return The logical extents of the current character.
  111.    */
  112.   Rectangle get_char_extents() const;
  113.  
  114.   
  115.   /** Gets the extents of the current cluster, in layout coordinates
  116.    * (origin is the top left of the entire layout).
  117.    * @param ink_rect Rectangle to fill with ink extents.
  118.    * @param logical_rect Rectangle to fill with logical extents.
  119.    */
  120.   void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
  121.  
  122.   /** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
  123.    * @return The extents of the current cluster as drawn.
  124.    */
  125.   Rectangle get_cluster_ink_extents() const;
  126.  
  127.   /** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
  128.    * @return The logical extents of the current cluster.
  129.    */
  130.   Rectangle get_cluster_logical_extents() const;
  131.  
  132.   
  133.   /** Gets the extents of the current run in layout coordinates
  134.    * (origin is the top left of the entire layout).
  135.    * @param ink_rect Rectangle to fill with ink extents.
  136.    * @param logical_rect Rectangle to fill with logical extents.
  137.    */
  138.   void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
  139.  
  140.   /** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
  141.    * @return The extents of the current run as drawn.
  142.    */
  143.   Rectangle get_run_ink_extents() const;
  144.  
  145.   /** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout).
  146.    * @return The logical extents of the current run.
  147.    */
  148.   Rectangle get_run_logical_extents() const;
  149.  
  150.   
  151.   /** Obtains the extents of the current line. @a ink_rect  or @a logical_rect 
  152.    * can be <tt>0</tt> if you aren't interested in them. Extents are in layout
  153.    * coordinates (origin is the top-left corner of the entire
  154.    * Pango::Layout).  Thus the extents returned by this function will be
  155.    * the same width/height but not at the same x/y as the extents
  156.    * returned from pango_layout_line_get_extents().
  157.    * @param ink_rect Rectangle to fill with ink extents.
  158.    * @param logical_rect Rectangle to fill with logical extents.
  159.    */
  160.   void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
  161.  
  162.   /** Obtains the ink extents of the current line.
  163.    * @return The extents of the current line as drawn.
  164.    */
  165.   Rectangle get_line_ink_extents() const;
  166.  
  167.   /** Obtains the logical extents of the current line.
  168.    * @return The logical extents of the current line.
  169.    */
  170.   Rectangle get_line_logical_extents() const;
  171.  
  172.   
  173.   /** Divides the vertical space in the Pango::Layout being iterated over
  174.    * between the lines in the layout, and returns the space belonging to
  175.    * the current line.  A line's range includes the line's logical
  176.    * extents, plus half of the spacing above and below the line, if
  177.    * pango_layout_set_spacing() has been called to set layout spacing.
  178.    * The y positions are in layout coordinates (origin at top left of the
  179.    * entire layout).
  180.    * @param y0 Start of line.
  181.    * @param y1 End of line.
  182.    */
  183.   void get_line_yrange(int& y0, int& y1) const;
  184.  
  185.   
  186.   /** Obtains the extents of the Pango::Layout being iterated
  187.    * over. @a ink_rect  or @a logical_rect  can be <tt>0</tt> if you
  188.    * aren't interested in them.
  189.    * @param ink_rect Rectangle to fill with ink extents.
  190.    * @param logical_rect Rectangle to fill with logical extents.
  191.    */
  192.   void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
  193.  
  194.   /** Obtains the ink extents of the Pango::Layout being iterated over.
  195.    * @return The extents of the layout as drawn.
  196.    */
  197.   Rectangle get_layout_ink_extents() const;
  198.  
  199.   /** Obtains the logical extents of the Pango::Layout being iterated over.
  200.    * @return The logical extents of the layout.
  201.    */
  202.   Rectangle get_layout_logical_extents() const;
  203.  
  204.   
  205.   /** Gets the y position of the current line's baseline, in layout
  206.    * coordinates (origin at top left of the entire layout).
  207.    * @return Baseline of current line.
  208.    */
  209.   int get_baseline() const;
  210.  
  211.   /// Provides access to the underlying C GObject.  
  212.   PangoLayoutIter*       gobj()       { return gobject_; }
  213.   /// Provides access to the underlying C GObject.
  214.   const PangoLayoutIter* gobj() const { return gobject_; }
  215.  
  216. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  217.   void assign_gobj(PangoLayoutIter* src);
  218. #endif
  219.  
  220. protected:
  221.   PangoLayoutIter* gobject_;
  222.  
  223. private:
  224.   // noncopyable
  225.   LayoutIter(const LayoutIter&);
  226.   LayoutIter& operator=(const LayoutIter&);
  227.  
  228.  
  229. };
  230.  
  231. } //namespace Pango
  232.  
  233.  
  234. #endif /* _PANGOMM_LAYOUTITER_H */
  235.  
  236.